package com.ztgf.shopping.service.shop;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.ztgf.commodity.models.dto.BrandInfoAuditDTO;
import com.ztgf.commodity.models.dto.BrandInfoDTO;
import com.ztgf.commodity.models.service.IBrandInfoAuditService;
import com.ztgf.commodity.models.service.IBrandInfoService;
import com.ztgf.shopping.common.config.YmlConfig;
import com.ztgf.shopping.mapper.shop.ShopQualificationAuditMapper;
import com.ztgf.shopping.models.bo.shop.*;
import com.ztgf.shopping.models.dto.audit.AuditDTO;
import com.ztgf.shopping.models.dto.shop.*;
import com.ztgf.shopping.models.enums.ShoppingCodeEnum;
import com.ztgf.shopping.models.service.audit.IAuditService;
import com.ztgf.shopping.models.service.shop.*;
import com.ztgf.shopping.models.vo.audit.RegisterShopVO;
import com.ztgf.shopping.models.vo.shop.ShopQualificationAuditBrandVO;
import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * 店铺资质审核表控制器
 *
 * @author zhanghualang
 * @Date 2020-06-23 11:58:06
 */
@DubboService
public class ShopQualificationAuditServiceImpl extends ServiceImpl<ShopQualificationAuditMapper, ShopQualificationAuditDTO> implements IShopQualificationAuditService{

    @Resource
    private YmlConfig ymlConfig;
    @Autowired
    private IShopQualificationAuditService iShopQualificationAuditService;
    @Autowired
    private IShopBrandRelationAuditService iShopBrandRelationAuditService;
    @DubboReference
    private IBrandInfoService iBrandInfoService;
    @DubboReference
    private IBrandInfoAuditService iBrandInfoAuditService;
    @DubboReference
    private IShopInfoAuditService iShopInfoAuditService;
    @Autowired
    @Lazy
    private IShopInfoService iShopInfoService;
    @Autowired
    private IShopInfoAuditLogService iShopInfoAuditLogService;
    @Autowired
    private IShopCategoryRelationAuditService iShopCategoryRelationAuditService;
    @DubboReference
    private IAuditService auditService;

    public Integer getQualificationInfoByShopId(Long id){
        Wrapper<ShopQualificationAuditDTO> wrapper = new EntityWrapper<>();
        //审核类型 0注册，1开店，2资质变更，3新增品牌，4新增类目
        wrapper.eq("shop_id", id).eq("audit_type", 2);
        //审核状态 0审核中，1审核通过，2审核打回，3审核不通过
        wrapper.eq("status", 0);
        //类型 0营业执照，1法人身份证，2开户许可证，3商标注册证书，4续展证明文件，5ISO认证书，6品牌授权书
        wrapper.andNew().eq("type", 0).or().eq("type",1).or().eq("type", 2);
        return selectCount(wrapper);
    }

    @Override
    public boolean add(ShopQualificationAuditSaveBO saveBO) {
        ShopQualificationAuditDTO dto = new ShopQualificationAuditDTO();
        BeanUtils.copyProperties(saveBO,dto);
        Long id = ymlConfig.getPkId();
        dto.setId(id);
        return this.insert(dto);
    }

    @Override
    public ShopQualificationAuditDTO getByUserId(Long id, Integer type, Integer auditType) {
        Wrapper<ShopQualificationAuditDTO> wrapper = new EntityWrapper<>();

        wrapper.eq("user_id", id).eq("type", type).eq("audit_type", auditType);

        return this.selectOne(wrapper);
    }

    @Override
    public List<ShopQualificationAuditDTO> queryListByShopAudit(Long shopAuditId, Integer status, Integer type) {
        Wrapper<ShopQualificationAuditDTO> wrapper = new EntityWrapper<>();
        wrapper.eq("shop_audit_id", shopAuditId).eq("status", status).eq("audit_type", type);
        return this.selectList(wrapper);
    }

    @Override
    public List<ShopQualificationAuditBrandVO> queryBrandList(Long id) {
        ArrayList<ShopQualificationAuditBrandVO> vos = new ArrayList<ShopQualificationAuditBrandVO>();
        /**
         * 1获取店铺品牌关联
         * 2获取品牌下所有资质
         */
        Wrapper<ShopBrandRelationAuditDTO> wrapper = new EntityWrapper<>();
        wrapper.eq("shop_id", id).eq("status", 0);
        wrapper.andNew().eq("type", ShoppingCodeEnum.AUDIT_TYPE_CHANGE.getCode()).or().eq("type", ShoppingCodeEnum.AUDIT_TYPE_INSERTBRAND.getCode());//类型 0注册，1开店，2资质变更，3新增品牌，4新增类目
        wrapper.groupBy("brand_id");

        List<ShopBrandRelationAuditDTO> shopBrandRelationAuditDTOList = iShopBrandRelationAuditService.selectList(wrapper);
        for (ShopBrandRelationAuditDTO shopBrandRelationAuditDTO : shopBrandRelationAuditDTOList){
            ShopQualificationAuditBrandVO vo = new ShopQualificationAuditBrandVO();

            if (shopBrandRelationAuditDTO.getBrandType() == 0){
                BrandInfoDTO brandInfoDTO = iBrandInfoService.selectById(shopBrandRelationAuditDTO.getBrandId());
                vo.setName(brandInfoDTO.getName());
                vo.setLogoUrl(brandInfoDTO.getLogoUrl());
            }else{
                BrandInfoAuditDTO brandInfoAuditDTO = iBrandInfoAuditService.selectById(shopBrandRelationAuditDTO.getBrandId());
                vo.setName(brandInfoAuditDTO.getName());
                vo.setLogoUrl(brandInfoAuditDTO.getLogoUrl());
            }

            //资质
            Wrapper<ShopQualificationAuditDTO> sQWrapper = new EntityWrapper<>();
            sQWrapper.eq("shop_id", id).eq("brand_id", shopBrandRelationAuditDTO.getBrandId()).eq("status", ShoppingCodeEnum.AUDIT_CREATE.getCode());
            sQWrapper.andNew().eq("audit_type", 2).or().eq("audit_type", 3);//类型 0注册，1开店，2资质变更，3新增品牌，4新增类目
            List<ShopQualificationAuditDTO> dtos = this.selectList(sQWrapper);
            if (dtos.size() <= 0){
                continue;
            }
            vo.setShopQualificationAuditDTOList(dtos);

            //类目
            Wrapper<ShopCategoryRelationAuditDTO> sCWrapper = new EntityWrapper<>();
            sCWrapper.eq("shop_id", id).eq("brand_id", shopBrandRelationAuditDTO.getBrandId()).eq("status", ShoppingCodeEnum.AUDIT_CREATE.getCode());
            sQWrapper.eq("type", ShoppingCodeEnum.AUDIT_TYPE_INSERTBRAND.getCode());//类型 0注册，1开店，2资质变更，3新增品牌，4新增类目
            List<ShopCategoryRelationAuditDTO> scdtos = iShopCategoryRelationAuditService.selectList(sCWrapper);
            if (scdtos.size() > 0){
                vo.setShopCategoryRelationAuditDTOList(scdtos);
            }

            vos.add(vo);
        }
        return vos;
    }

    @Override
    public boolean isAudit(ShopQualificationAuditIsBO bo) {
        Wrapper<ShopQualificationAuditDTO> wrapper = new EntityWrapper<>();
        wrapper.eq("shop_id", bo.getShopId()).eq("type", bo.getType());
        wrapper.eq("status", 0);//审核状态 0审核中，1审核通过，2审核打回，3审核不通过
        if (bo.getBrandId() != null && !"".equals(bo.getBrandId())){
            wrapper.eq("brand_id", bo.getBrandId());
        }
        Integer total = this.selectCount(wrapper);
        return total > 0;
    }

    @Override
    @Transactional
    public boolean addChange(ShopQualificationAuditSaveListBO bo) {
        //debug 事务预留

        Long userId = bo.getUserId();
        Long shopId = bo.getShopId();
        /**
         * 1.新增审核日志
         * 2.新增店铺审核表
         * 3.新增资质审核
         */
        Integer type = 2;
        //新增店铺审核表
        Long shopInfoAuditId = addShopInfoAudit(shopId, userId, type);

        //新增审核日志
        addAuditLog(shopInfoAuditId, shopId, userId, type);

        List<ShopQualificationAuditSaveBO> shopQualificationAuditSaveBOS = JSON.parseArray(bo.getShopQualificationAuditSaveBOS(),ShopQualificationAuditSaveBO.class);
        for (ShopQualificationAuditSaveBO saveBO : shopQualificationAuditSaveBOS){
            if (saveBO.getBrandId() != null){
                //保存关联关系审核
                ShopBrandRelationAuditDTO shopBrandRelationAuditDTO = new ShopBrandRelationAuditDTO();
                shopBrandRelationAuditDTO.setId(ymlConfig.getPkId());
                shopBrandRelationAuditDTO.setCreateUserId(userId);
                shopBrandRelationAuditDTO.setShopId(shopId);
                shopBrandRelationAuditDTO.setShopAuditId(shopInfoAuditId);
                shopBrandRelationAuditDTO.setBrandId(saveBO.getBrandId());
                shopBrandRelationAuditDTO.setBrandType(0);//品牌是否存在 0存在。1不存在 默认0
                shopBrandRelationAuditDTO.setStatus(0);//是否审核 0未审核、1打回、2审核通过、3审核失败
                shopBrandRelationAuditDTO.setType(2);//类型 0注册，1开店，2资质变更，3新增品牌，4新增类目
                iShopBrandRelationAuditService.insert(shopBrandRelationAuditDTO);
            }

            ShopQualificationAuditDTO qualificationAuditDTO = new ShopQualificationAuditDTO();
            BeanUtils.copyProperties(saveBO,qualificationAuditDTO);
            qualificationAuditDTO.setId(ymlConfig.getPkId());
            qualificationAuditDTO.setShopId(bo.getShopId());
            qualificationAuditDTO.setShopAuditId(shopInfoAuditId);
            qualificationAuditDTO.setAuditType(type);
            qualificationAuditDTO.setCreateUserId(userId);
            qualificationAuditDTO.setStatus(0);//是否审核 0未审核、1打回、2审核通过、3审核失败

            iShopQualificationAuditService.insert(qualificationAuditDTO);
        }

        return true;
    }

    @Override
    @Transactional
    public boolean addBrand(ShopQualificationAuditBrandListBO bo) {
        /**
         * 1.新增审核日志
         * 2.新增店铺审核表
         * 3.新增店铺品牌关联表审核
         * 4.新增资质审核
         * 5.新增品牌分类审核
         * 6.新增品牌来一遍345
         */

        Long userId = bo.getUserId();
        Long shopId = bo.getShopId();


        /**
         * 保存店铺品牌关系审核表
         */

        List<ShopQualificationAuditBrandBO> shopQualificationAuditBrandBOList = JSON.parseArray(bo.getShopQualificationAuditBrandBOList(), ShopQualificationAuditBrandBO.class);
        for (ShopQualificationAuditBrandBO brandBO : shopQualificationAuditBrandBOList){
            //新增店铺审核表
            Long shopInfoAuditId = addShopInfoAudit(shopId, userId, 3);

            //新增审核日志
            addAuditLog(shopInfoAuditId, shopId, userId, 3);

            //保存关联关系审核
            ShopBrandRelationAuditDTO shopBrandRelationAuditDTO = new ShopBrandRelationAuditDTO();
            shopBrandRelationAuditDTO.setId(ymlConfig.getPkId());
            shopBrandRelationAuditDTO.setCreateUserId(userId);
            shopBrandRelationAuditDTO.setShopId(shopId);
            shopBrandRelationAuditDTO.setShopAuditId(shopInfoAuditId);
            shopBrandRelationAuditDTO.setBrandId(brandBO.getBrandId());
            shopBrandRelationAuditDTO.setBrandType(0);//品牌是否存在 0存在。1不存在 默认0
            shopBrandRelationAuditDTO.setStatus(0);//是否审核 0未审核、1打回、2审核通过、3审核失败
            shopBrandRelationAuditDTO.setType(3);//类型 0注册，1开店，2资质变更，3新增品牌，4新增类目
            iShopBrandRelationAuditService.insert(shopBrandRelationAuditDTO);

            /**
             * 保存资质审核表
             */
            List<ShopQualificationSaveBO> shopQualificationSaveBOList = JSON.parseArray(brandBO.getShopQualificationSaveBOList(), ShopQualificationSaveBO.class);
            for (ShopQualificationSaveBO shopQualificationSaveBO : shopQualificationSaveBOList){
                ShopQualificationAuditDTO shopQualificationAuditDTO = new ShopQualificationAuditDTO();
                shopQualificationAuditDTO.setId(ymlConfig.getPkId());
                shopQualificationAuditDTO.setCreateUserId(userId);
                shopQualificationAuditDTO.setShopAuditId(shopInfoAuditId);
                shopQualificationAuditDTO.setShopId(shopId);
                shopQualificationAuditDTO.setBrandId(shopQualificationSaveBO.getBrandId());
                shopQualificationAuditDTO.setFileUrl(shopQualificationSaveBO.getFileUrl());//图片url
                shopQualificationAuditDTO.setBeginDate(shopQualificationSaveBO.getBeginDate());
                shopQualificationAuditDTO.setEndDate(shopQualificationSaveBO.getEndDate());
                //类型 0营业执照，1法人身份证，3开户许可证，4商标注册证书，5续展证明文件，6ISO认证书，7品牌授权书、
                shopQualificationAuditDTO.setType(shopQualificationSaveBO.getType());
                //审核类型 0注册，1开店，2资质变更，3新增品牌，4新增类目
                shopQualificationAuditDTO.setAuditType(3);
                shopQualificationAuditDTO.setStatus(0);//审核状态 0审核中，1审核通过，2审核打回，3审核不通过
                iShopQualificationAuditService.insert(shopQualificationAuditDTO);
            }

            /**
             * 保存品牌分类审核表
             */
            List<ShopCategoryRelationSaveBO> shopCategoryRelationSaveBOList = JSON.parseArray(brandBO.getShopCategoryRelationSaveBOList(), ShopCategoryRelationSaveBO.class);
            //foreach品牌分类
            for (ShopCategoryRelationSaveBO shopCategoryRelationSaveBO : shopCategoryRelationSaveBOList){
                ShopCategoryRelationAuditDTO shopCategoryRelationAuditDTO = new ShopCategoryRelationAuditDTO();
                shopCategoryRelationAuditDTO.setId(ymlConfig.getPkId());
                shopCategoryRelationAuditDTO.setCreateUserId(userId);
                shopCategoryRelationAuditDTO.setShopAuditId(shopInfoAuditId);
                shopCategoryRelationAuditDTO.setShopId(shopId);
                shopCategoryRelationAuditDTO.setBrandId(shopCategoryRelationSaveBO.getBrandId());
                shopCategoryRelationAuditDTO.setCategoryId(shopCategoryRelationSaveBO.getCategoryId());
                shopCategoryRelationAuditDTO.setType(3);//审核类型 0注册，1开店，2资质变更，3新增品牌，4新增类目
                shopCategoryRelationAuditDTO.setStatus(0);//审核状态 0审核中，1审核通过，2审核打回，3审核不通过
                iShopCategoryRelationAuditService.insert(shopCategoryRelationAuditDTO);
            }
        }

        /**
         * 新增品牌
         */
        if (bo.getShopInfoIncreaseBrandSaveBOList() != null && !"".equals(bo.getShopInfoIncreaseBrandSaveBOList())){
            List<ShopInfoIncreaseBrandSaveBO> shopInfoIncreaseBrandSaveBOList = JSON.parseArray(bo.getShopInfoIncreaseBrandSaveBOList(), ShopInfoIncreaseBrandSaveBO.class);
            for (ShopInfoIncreaseBrandSaveBO shopInfoIncreaseBrandSaveBO : shopInfoIncreaseBrandSaveBOList){
                /**
                 * 1.增加品牌审核表
                 * 2.增加关系审核表
                 * 3.增加资质审核表
                 * 4.增加品牌分类审核表
                 */
                /**
                 * 增加品牌审核
                 */

                //新增店铺审核表
                Long shopInfoAuditId = addShopInfoAudit(shopId, userId, 3);

                //新增审核日志
                addAuditLog(shopInfoAuditId, shopId, userId, 3);
                BrandInfoAuditDTO brandInfoAuditDTO = new BrandInfoAuditDTO();
                Long brandAuditId = ymlConfig.getPkId();
                brandInfoAuditDTO.setId(brandAuditId);
                brandInfoAuditDTO.setCreateUserId(userId);
                brandInfoAuditDTO.setType(3);//类型 0注册，1开店，2资质变更，3新增品牌，4新增类目
                brandInfoAuditDTO.setName(shopInfoIncreaseBrandSaveBO.getName());
                brandInfoAuditDTO.setLogoUrl(shopInfoIncreaseBrandSaveBO.getLogoUrl());
                brandInfoAuditDTO.setShopId(shopId);
                brandInfoAuditDTO.setShopAuditId(shopInfoAuditId);
                brandInfoAuditDTO.setStatus(0);//状态 0未审核、1打回、2审核通过、3审核失败
                iBrandInfoAuditService.insert(brandInfoAuditDTO);

                ShopBrandRelationAuditDTO shopBrandRelationAuditDTO = new ShopBrandRelationAuditDTO();
                shopBrandRelationAuditDTO.setId(ymlConfig.getPkId());
                shopBrandRelationAuditDTO.setShopId(shopId);
                shopBrandRelationAuditDTO.setShopAuditId(shopInfoAuditId);
                shopBrandRelationAuditDTO.setBrandId(brandAuditId);
                shopBrandRelationAuditDTO.setBrandType(1);//品牌是否存在 0存在。1不存在 默认0
                shopBrandRelationAuditDTO.setStatus(0);//是否审核 0未审核、1打回、2审核通过、3审核失败
                shopBrandRelationAuditDTO.setType(3);//类型 0注册，1开店，2资质变更，3新增品牌，4新增类目
                iShopBrandRelationAuditService.insert(shopBrandRelationAuditDTO);

                /**
                 * 增加资质审核表
                 */
                List<ShopQualificationSaveBO> newQualificationSaveBOList = JSON.parseArray(shopInfoIncreaseBrandSaveBO.getShopQualificationSaveBOList(), ShopQualificationSaveBO.class);

                for (ShopQualificationSaveBO newQualificationSaveBO : newQualificationSaveBOList){
                    ShopQualificationAuditDTO shopQualificationAuditDTO = new ShopQualificationAuditDTO();
                    shopQualificationAuditDTO.setId(ymlConfig.getPkId());
                    shopQualificationAuditDTO.setCreateUserId(userId);
                    shopQualificationAuditDTO.setShopAuditId(shopInfoAuditId);
                    shopQualificationAuditDTO.setShopId(shopId);
                    shopQualificationAuditDTO.setBrandId(brandAuditId);

                    shopQualificationAuditDTO.setFileUrl(newQualificationSaveBO.getFileUrl());//图片url
                    shopQualificationAuditDTO.setBeginDate(newQualificationSaveBO.getBeginDate());
                    shopQualificationAuditDTO.setEndDate(newQualificationSaveBO.getEndDate());
                    //类型 0营业执照，1法人身份证，3开户许可证，4商标注册证书，5续展证明文件，6ISO认证书，7品牌授权书、
                    shopQualificationAuditDTO.setType(newQualificationSaveBO.getType());
                    //审核类型 0注册，1开店，2资质变更，3新增品牌，4新增类目
                    shopQualificationAuditDTO.setAuditType(3);
                    shopQualificationAuditDTO.setStatus(0);//审核状态 0审核中，1审核通过，2审核打回，3审核不通过
                    iShopQualificationAuditService.insert(shopQualificationAuditDTO);
                }

                /**
                 * 保存品牌分类审核表
                 */
                List<ShopCategoryRelationSaveBO> newCategoryRelationSaveBOList = JSON.parseArray(shopInfoIncreaseBrandSaveBO.getShopCategoryRelationSaveBOList(), ShopCategoryRelationSaveBO.class);
                //foreach品牌分类
                for (ShopCategoryRelationSaveBO newCategoryRelationSaveBO : newCategoryRelationSaveBOList){
                    ShopCategoryRelationAuditDTO shopCategoryRelationAuditDTO = new ShopCategoryRelationAuditDTO();
                    shopCategoryRelationAuditDTO.setId(ymlConfig.getPkId());
                    shopCategoryRelationAuditDTO.setCreateUserId(userId);
                    shopCategoryRelationAuditDTO.setShopAuditId(shopInfoAuditId);
                    shopCategoryRelationAuditDTO.setShopId(shopId);
                    shopCategoryRelationAuditDTO.setBrandId(brandAuditId);
                    shopCategoryRelationAuditDTO.setCategoryId(newCategoryRelationSaveBO.getCategoryId());
                    shopCategoryRelationAuditDTO.setType(3);//审核类型 0注册，1开店，2资质变更，3新增品牌，4新增类目
                    shopCategoryRelationAuditDTO.setStatus(0);//审核状态 0审核中，1审核通过，2审核打回，3审核不通过
                    iShopCategoryRelationAuditService.insert(shopCategoryRelationAuditDTO);
                }
            }
        }

        return true;
    }

    @Override
    public boolean updateMay(ShopQualificationAuditDTO dto) {
        return baseMapper.updateMay(dto);
    }

    @Override
    public boolean isQAudit(ShopQualificationAuditIsBO bo) {
        Wrapper<AuditDTO> wrapper = new EntityWrapper<>();
        wrapper.eq("shop_id", bo.getShopId()).eq("type", ShoppingCodeEnum.AUDIT_TYPE_CHANGE.getCode());
        wrapper.eq("status", 0);//审核状态 0审核中，1审核通过，2审核打回，3审核不通过
        List<AuditDTO> auditDTOList = auditService.selectList(wrapper);

        boolean flag = false;
        for (AuditDTO auditDTO : auditDTOList){
            RegisterShopVO registerShopVO = JSONObject.parseObject(auditDTO.getParams(), RegisterShopVO.class);
            List<RegisterShopVO.QualificationInfoVO> qualificationInfoVOList = registerShopVO.getQualificationInfoVOList();
            for (RegisterShopVO.QualificationInfoVO qualificationInfoVO : qualificationInfoVOList){
                if (bo.getBrandId() != null){
                    if (qualificationInfoVO.getBrandId().getValue().equals(bo.getBrandId().toString()) && qualificationInfoVO.getQtype().getValue().equals(bo.getType().toString())){
                        flag = true;
                        break;
                    }
                }
                if (qualificationInfoVO.getQtype().getValue().equals(bo.getType().toString())){
                    flag = true;
                    break;
                }
            }
            if (flag){
                break;
            }
        }
        return flag;
    }

    //新增店铺审核表
    private Long addShopInfoAudit(Long shopId, Long userId, Integer type){
        ShopInfoDTO shopInfoDTO = iShopInfoService.selectById(shopId);
        //新增店铺审核表
        ShopInfoAuditDTO shopInfoAuditDTO = new ShopInfoAuditDTO();
        Long shopInfoAuditId = ymlConfig.getPkId();
        shopInfoAuditDTO.setId(shopInfoAuditId);
        shopInfoAuditDTO.setCreateUserId(userId);
        shopInfoAuditDTO.setShopId(shopId);
        shopInfoAuditDTO.setName(shopInfoDTO.getName());//公司名称
        shopInfoAuditDTO.setShopName(shopInfoDTO.getShopName());//店铺名称
        shopInfoAuditDTO.setShopAbbreviation(shopInfoDTO.getShopAbbreviation());//店铺简称
        shopInfoAuditDTO.setIdCardType(shopInfoDTO.getIdCardType());//证件类型
        shopInfoAuditDTO.setType(type);//审核类型 0注册，1开店，2资质变更，3新增品牌，4新增类目
        shopInfoAuditDTO.setStatus(0);//审核状态 0审核中，1审核通过，2审核打回，3审核不通过
        iShopInfoAuditService.insert(shopInfoAuditDTO);
        return shopInfoAuditId;
    }

    private boolean addAuditLog(Long shopInfoAuditId, Long shopId, Long userId, Integer type){
        ShopInfoAuditLogDTO shopInfoAuditLogDTO = new ShopInfoAuditLogDTO();
        shopInfoAuditLogDTO.setId(ymlConfig.getPkId());
        shopInfoAuditLogDTO.setShopAuditId(shopInfoAuditId);
        shopInfoAuditLogDTO.setCreateUserId(userId);
        shopInfoAuditLogDTO.setShopId(shopId);
        shopInfoAuditLogDTO.setType(type);
        shopInfoAuditLogDTO.setStatus(0);
        return iShopInfoAuditLogService.insert(shopInfoAuditLogDTO);
    }

}
